package cn.myjerry.iter;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;

public class Test {
	public static void main(String[] args) {
		List<String> list = new ArrayList<String>();
		list.add("aaa");
		list.add("bbb");
		list.add("ccc");
		for(Iterator<String> iter = list.iterator();iter.hasNext();) {
			System.out.println(iter.next());
		}
		
		Set<String> set = new HashSet<String>();
		set.add("ddd");
		set.add("eee");
		set.add("fff");
		Iterator<String> iter = set.iterator();
		while(iter.hasNext()) {
			System.out.println(iter.next());
		}
		System.out.println(set.size());
	}
}
